﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
    CodeBehind="GioHang.aspx.cs" Inherits="SES.CMS.GioHang" Title="Untitled Page" %>

<%@ Register Src="~/Module/ucSanPhamBanChay.ascx" TagName="ucSanBanChay" TagPrefix="uc5" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel runat="server" UpdateMode="Conditional"><ContentTemplate>
            <asp:Label ID="lbl" runat="server"></asp:Label>
            <asp:GridView runat="server" ID="GridGioHang" AutoGenerateColumns="False" EmptyDataText="Không có dữ liệu !"
                AllowPaging="True" OnPageIndexChanging="GridGioHang_PageIndexChanging" OnRowCommand="GridGioHang_RowCommand"
                CellPadding="4" Width="727px" BackColor="White" BorderColor="#CC9966" BorderStyle="None"
                BorderWidth="1px" OnRowDataBound="GridGioHang_RowDataBound" DataKeyNames="STT"
                OnDataBinding="GridGioHang_DataBinding" OnDataBound="GridGioHang_DataBound">
                <RowStyle BackColor="White" ForeColor="#330099" />
                <Columns>
                    <asp:TemplateField HeaderText="STT" ItemStyle-Width="13px">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lbSTT" Text="<%# Container.DataItemIndex + 1 %>">
                            </asp:Label>
                            
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <FooterTemplate>
                            Tổng tiền:
                        </FooterTemplate>
                        <FooterStyle BorderColor="White" Font-Bold="true" ForeColor="Red" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Tên sản phẩm" ItemStyle-Width="180px">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="txtTen" Text='<%#DataBinder.Eval(Container.DataItem,"TenSanPham") %>'>
                            </asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Left" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Ảnh SP" ItemStyle-Width="65px">
                        <ItemTemplate>
                            <a class="fackybox" href="/Media/<%#Eval("HinhAnh")%>" />
                            <img src="/Media/<%#Eval("HinhAnh")%>" height="40px" width="64px" /></a>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Số Lượng" ItemStyle-Width="50px">
                        <ItemTemplate>
                            <asp:TextBox runat="server" OnTextChanged="Calc" AutoPostBack="true" ID="txtSL" Width="20px"
                                Text='<%#DataBinder.Eval(Container.DataItem,"SoLuong") %>'>
                            </asp:TextBox>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <FooterStyle BorderColor="White" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Đơn Giá" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="90px">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lbDG" Text='<%#DataBinder.Eval(Container.DataItem,"DonGia","{0:0,0 VNĐ}") %>'>
                            </asp:Label>
                        </ItemTemplate>
                        <FooterStyle BorderColor="White" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Giảm Giá (%)" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="70px">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lbDGG" Text='<%#Eval("GiamGia") +"%" %>'>
                            </asp:Label>
                        </ItemTemplate>
                        <FooterStyle BorderColor="White" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Thành Tiền" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="110px">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lbThanhTien" Font-Bold="true" Text='<%#DataBinder.Eval(Container.DataItem,"ThanhTien","{0:0,0 VNĐ}") %>'>
                            </asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:Label ID="lbTong" runat="server" Font-Bold="true" ForeColor="Red"></asp:Label>
                        </FooterTemplate>
                        <FooterStyle HorizontalAlign="Center" BorderColor="White" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Thao tác">
                        <ItemTemplate>
                            <asp:ImageButton runat="server" ID="imgUpdate" CommandName="capnhat" ToolTip="Cập nhật số lượng"
                                CommandArgument='<%#DataBinder.Eval(Container.DataItem,"STT") %>' ImageUrl="/images/update_quantity.png" />
                            <asp:ImageButton runat="server" ID="img_xoa" CommandName="xoa" OnClientClick="return confirm('Bạn có muốn loại bỏ sản phẩm này ra khỏi giỏ hàng?')"
                                CommandArgument='<%#DataBinder.Eval(Container.DataItem,"STT") %>' ImageUrl="/images/remove.png" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <FooterStyle BorderColor="White" />
                    </asp:TemplateField>
                </Columns>
                <FooterStyle BackColor="White" ForeColor="#000066" />
                <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
                <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
            </asp:GridView>
            <br />
            <div style="width: 400px; margin-left: auto; margin-right: 10px; text-align: right;">
                <asp:Label ID="lblSum" runat="server"></asp:Label><br />
                <asp:Label ID="lbThanhTien" runat="server"></asp:Label>
            </div>
        </ContentTemplate></asp:UpdatePanel>
            <div align="center" style="margin-top: 10px;" class="ltr dGioHang">
                <a href="/Default.aspx" class="continue_link">Tiếp tục mua hàng</a>
                <asp:HyperLink runat="server" ID="lbThanhtoan" CssClass="checkout_link" Text="Gửi đơn hàng"
                    NavigateUrl="/ThanhToan.aspx"></asp:HyperLink>
                <div style="margin-top: 40px;">
                    <hr />
                    <div class="SP">
                        Sản phẩm bán chạy<img src="/images/temp.jpg" align="top" width="575px" alt="tem" />
                        <asp:Repeater ID="rpt" runat="server" OnItemCommand="rpt_ItemCommand">
                            <ItemTemplate>
                                <div class="product-box">
                                    <div class="product-img">
                                        <a href="<%#"/SanPhamChiTiet/"+Eval("SanPhamID")+"/"+FriendlyUrl(Eval("TenSanPham").ToString())%>">
                                            <img src="/Media/<%#Eval("HinhAnh")%>" /></a>
                                        <asp:Button CommandArgument='<%#Eval("SanPhamID")%>' runat="server" ID="btDatMua"
                                            Text="ĐẶT MUA" Width="90px" BorderWidth="0px" CssClass="btn" Height="25px" BackColor="#009345" />
                                    </div>
                                    <div class="product-detail">
                                        <div style="float: left; width: 120px; height: 95px;">
                                            <a href="<%#"/SanPhamChiTiet/"+Eval("SanPhamID")+"/"+FriendlyUrl(Eval("TenSanPham").ToString())%>">
                                                <%#Eval("TenSanPham")%></a>
                                            <div class="dMota">
                                                <%#Eval("Mota")%></div>
                                        </div>
                                        <div style="float: left; color: #c20b47; font-size: 12px; text-transform: uppercase">
                                            Giá:
                                            <%#(bool)(Int64.Parse(Eval("DonGia").ToString())==0)?"Liên hệ":Eval("DonGia","{0:0,0} VNĐ")%>
                                        </div>
                                    </div>
                                </div>
                            </ItemTemplate>
                        </asp:Repeater>
                        <asp:Label runat="server" Text="" ID="lbThongbao"></asp:Label>
                    </div>
                    <div style="width: 100%; float: left; margin-top: 10px;">
                        <div style="float: left;">
                            <asp:ImageButton ID="cmdPrev" Visible="false" OnClick="cmdPrev_Click" runat="server"
                                ImageUrl="~/images/prevpage.png" /></div>
                        <div style="float: right;">
                            <asp:ImageButton ID="cmdNext" Visible="false" OnClick="cmdNext_Click" runat="server"
                                ImageUrl="~/images/nextpage.png" /></div>
                    </div>
                </div>
 
</asp:Content>
